const mongoose = require("mongoose");
//用户信息数据库
const schema = new mongoose.Schema(
  {
    username: { type: String },
    icon: { type: String },
    phone: { type: String },
    password: {
      type: String,
      select: false,
      set(val) {
        return require("bcrypt").hashSync(val, 10);
      },
    },
  },
  {
    timestamps: true,
  }
);

module.exports = mongoose.model("User", schema);
